<?php

use Illuminate\Http\Request;

//没有登录
Route::group(["namespace" => 'Api'], function () {
    //用户相关
    Route::group(["prefix" => 'user'], function ($router) {
        $router->post('register', 'UserController@registerUser');//账号密码注册
        $router->post('login_pass', 'UserController@loginPass');//密码登录
    });
});

//不要求强制登录
Route::group(["namespace" => 'Api', 'middleware' => ['user']], function () {

    Route::group(["prefix" => 'course'], function ($router) {
        $router->get('lists', 'CourseController@lists');//课程列表
        $router->get('detail', 'CourseController@detail');//课程详情
    });
    Route::get('category/lists', 'CourseController@categoryLists');//课程分类
    Route::group(["prefix" => 'platform'], function ($router) {
        $router->get('resource', 'PlatformController@resourceList');//平台资源
    });
});
//要求登录
Route::group(["namespace" => 'Api', 'middleware' => ['user.auth']], function () {
    Route::group(["prefix" => 'user'], function ($router) {
        $router->get('main', 'UserCenterController@userInfo');
        $router->post('logout', 'UserController@logout')->name('logout');
    });
    Route::group(["prefix" => 'upload'], function ($router) {
        $router->post('images', 'UploadController@upload');
    });
});

